﻿using System;

namespace Calculator
{
    class Program
    {
        static void Main(string[] args)
        {
            //2个double类型数据的运算
            Console.Write("请输入第一个数字：");
            String a = Console.ReadLine();

            Console.Write("请输入第二个数字：");
            String b = Console.ReadLine();

            Console.Write("请输入运算符：");
            String o = Console.ReadLine();

            Operator opt;
            switch (o)
            {
                case "+":
                    opt = new AddOperator();
                    break;
                case "-":
                    opt = new SubOperator();
                    break;
                default:
                    Console.WriteLine("非法输入！！！！");
                    return;
            }
            opt.num1 = double.Parse(a);
            opt.num2 = double.Parse(b);

            Console.WriteLine($"{a} {o} {b} = {opt.GetResult()}");
        }
    }
}
